Pass variable in url_for to Python function